<!DOCTYPE HTML>
<meta charset="utf-8">
<title>随机数生成器</title>
<head>	
	<link rel="icon" href="./Assets/app.png" type="image/x-icon">
</head>
<body>
    <center>
	<h1>随机数生成器</h1>
	</center>
	最小值：<input type="" name="" id="ranmin" value="0">
	<br><br>
	最大值：<input type="" name="" id="ranmax" value="100">
	<br><br>
	生成个数：<input type="" name="" id="rangs" value="1">
	<br><br>
	<button style="font-size: 25px;" id="ranbt" onclick="random()" disabled><b>生成随机数</b></button>
	<br><br>
	结果：<b id="ranshow" style="font-size: 30px;"></b>
	<br><br>
	<center><h6><a href="./random.html" target="_blank">在新标签页中打开</a><h6></center>
	<!--<center><br><h6>（修改自<a href="https://suntrise.github.io">STR</a> 随机数生成器）</h6></center>-->
</body>

<style type="text/css">
	body{
		font-size: 20px;
		background: #eee;
		color: #000;
	}
	input{
		font-size: 25px;
	}
	button{
		padding: 20px;
		color: #000;
		border: 2px solid #459439;
		border-radius: 3px;
		background: #A2FF74;
	}
	button:hover {
    border: 2px solid #fff;
}
	@media (prefers-color-scheme: dark) {
            body {
                background-color: rgb(40,40,40);
				color: #fff;
            }
			button{
				padding: 20px;
				color: #fff;
				border: 2px solid #65D954;
				border-radius: 3px;
				background: #459439;
			}
	 }  	
</style>

<script type="text/javascript">
	var min = 0
	var max = 0
	var ran = 0
	var gs = 0
	var ranstr = ""
	var ctd = setInterval(ranch,1)
function ranch() {
	min = Math.floor(ranmin.value)
	max = Math.floor(ranmax.value)
	if(min>max){
		ranbt.disabled = true;
		ranshow.innerHTML = "最小值不能大于最大值！"
	}
	else{
		ranbt.disabled = "";
		ranshow.innerHTML = ranstr;
	}
}
function random() {
	ranstr = "";
    while(gs<rangs.value){
    	min = Math.floor(ranmin.value)
		max = Math.floor(ranmax.value)
    	ran = Math.round(min+Math.random()*(max-min))
    	gs++
    	ranstr += ran +" ";
    }
    if (gs==rangs.value) {
    	gs=0
    	ranshow.innerHTML = ranstr;
    }
}
</script>
